package personnal.blog2pdf.processor;

import org.springframework.batch.item.ItemProcessor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import personnal.blog2pdf.data.PostInfo;
import personnal.blog2pdf.reader.WordpressClient;

@Component
public class PostInfoDetailFetchProcessor implements ItemProcessor<PostInfo, PostInfo> {

    @Autowired
    private WordpressClient wordpressClient;

    @Override
    public PostInfo process(PostInfo postInfo) throws Exception {
        return this.wordpressClient.getPostById(postInfo.getId());
    }

    public void setWordpressClient(WordpressClient wordpressClient) {
        this.wordpressClient = wordpressClient;
    }
}
